//
//  YWNewDetailInspectionMisionCell.m
//  maintain
//
//  Created by 郑想 on 16/7/25.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import "YWInspectionMisionDetailCell.h"
#import "Masonry.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "UIColor+CustomColors.h"
#import "UIImageView+WebCache.h"
#import "YWMacro.h"
#import "YWCommonTool.h"
//#import "UILabel+AttributedText.h"
#import "YYLabel.h"

#import "YWHandler.h"
#import "YWEquipment.h"
#import "YWBuilding.h"
#import "YWBuildingManager.h"
#import "YWInspectionMissionModel.h"
#import "YWInspectionMissionManager.h"
#import "YWReplyManager.h"

@interface YWInspectionMisionDetailCell()
/** 头像 */
@property (nonatomic, strong) UIImageView *headImageView;
/** 发布者 */
@property (nonatomic, strong) YYLabel *responseNameLabel;
/** 发布时间 */
@property (nonatomic, strong) YYLabel *createTimeLabel;
/** 编号 */
@property (nonatomic, strong) YYLabel *numberLabel;
/** 巡查人 */
@property (nonatomic, strong) YYLabel *inspectionManLabel;
/** 巡查位置 */
@property (nonatomic, strong) YYLabel *inspectionSiteLabel;
/** 巡查路线 */
@property (nonatomic, strong) YYLabel *inspectionRoutLabel;
/** 要求 */
@property (nonatomic, strong) YYLabel *noteLabel;
/** 巡查日 */
@property (nonatomic, strong) YYLabel *inspectionDay;
/** 开始时间 */
@property (nonatomic, strong) YYLabel *startTimeLabel;
/** 结束时间 */
@property (nonatomic, strong) YYLabel *endTimeLabel;
/** 每日巡查时间 */
@property (nonatomic, strong) YYLabel *daylyInspectionTimeLabel;
/** 巡查间隔 */
@property (nonatomic, strong) YYLabel *inspectionIntervalLabel;
/** 当前巡查时间 */
@property (nonatomic, strong) YYLabel *nowInspectionTimeLabel;
/** 已完成 */
@property (nonatomic, strong) YYLabel *hasFinishLabel;
///** 评论图标 */
//@property (nonatomic, strong) UIImageView *replyIcon;
///** 评论数量 */
//@property (nonatomic, strong) YYLabel *replyNumberLabel;
///** 参与者图标 */
//@property (nonatomic, strong) UIImageView *observerIcon;
///** 参与者数量 */
//@property (nonatomic, strong) YYLabel *observerNumberLabel;
@end

@implementation YWInspectionMisionDetailCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    YWInspectionMisionDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:YWInspectionMisionDetailCellIdentifier];
    if (cell == nil) {
        cell = [[YWInspectionMisionDetailCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:YWInspectionMisionDetailCellIdentifier];
    }
    return cell;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.layer.shouldRasterize = YES;
        self.layer.rasterizationScale = [UIScreen mainScreen].scale;
        [self setUpSubviews];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.separatorInset = UIEdgeInsetsMake(0, SCREEN_WIDTH, 0, 0);
    }
    return self;
}

-(void)setInspectionMission:(YWInspectionMissionModel *)inspectionMission{
    _inspectionMission = inspectionMission;
    //头像
    NSString* downloadUrl = [YWCommonTool pictureDownloadUrl:inspectionMission.creator.headIcon];
    [_headImageView sd_setImageWithURL:[NSURL URLWithString:downloadUrl] placeholderImage:[UIImage imageNamed:@"profile_headimage"]];
    
    //发布者
    _responseNameLabel.text = inspectionMission.creator.userName;
    
    //    时间
    _createTimeLabel.text = [YWCommonTool showTimeWithNormalFormatter:inspectionMission.createTime/1000];
    
    //巡查人
    NSString *executor = [YWCommonTool handlerNamesWithHandlers:inspectionMission.executors];
    //[_inspectionManLabel labelText:@"巡查人: " withAttributedText:executor.length?executor:@"无" andAttributedColor:[UIColor customYellowColor]];
    _inspectionManLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"inspectionExecutorFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:executor.length?executor:@"无" secondColor:[UIColor customYellowColor] font:kContentFont];
    
    [self setupInspectionMissionInfo:inspectionMission];
}

- (void)setInspectionLineRecord:(YWInspectionLineRecord *)inspectionLineRecord{
    _inspectionLineRecord = inspectionLineRecord;
    //头像
    NSString* downloadUrl = [YWCommonTool pictureDownloadUrl:nil];
    [_headImageView sd_setImageWithURL:[NSURL URLWithString:downloadUrl] placeholderImage:[UIImage imageNamed:@"profile_headimage"]];
    
    //巡查人
    NSString *executor = inspectionLineRecord.result == YWInspectionLineRecordResultSystem? NSLocalizedString(@"noManToInspection", nil) : [YWCommonTool handlerNamesWithHandlers:inspectionLineRecord.executors];
    _responseNameLabel.text = executor.length?executor:NSLocalizedString(@"none", nil);
    
    //时间
    _createTimeLabel.text = [YWCommonTool showTimeWithNormalFormatter:inspectionLineRecord.endTime/1000];
    
    //发布者
    NSString *creator = inspectionLineRecord.inspectionMission.creator.userName;
    //[_inspectionManLabel labelText:@"创建人: " withAttributedText:creator.length?creator:@"无" andAttributedColor:[UIColor customYellowColor]];
    _inspectionManLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"creatorFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:creator.length?creator:NSLocalizedString(@"none", nil) secondColor:[UIColor customYellowColor] font:kContentFont];
    
    [self setupInspectionMissionInfo:inspectionLineRecord.inspectionMission];
}

- (void)setupInspectionMissionInfo:(YWInspectionMissionModel*)inspectionMission{
    //编号
    //[_numberLabel labelText:@"编号: " withAttributedText:inspectionMission.missionSequence.length>0?inspectionMission.missionSequence:@"无" andAttributedColor:[UIColor customYellowColor]];
    NSString *sequenceText = inspectionMission.missionSequence.length>0?inspectionMission.missionSequence:NSLocalizedString(@"none", nil);
    _numberLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"codeFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:sequenceText secondColor:[UIColor customYellowColor] font:kContentFont];
    
    //位置
    YWBuilding *building = nil;
    if (inspectionMission.inspectionLine.lineType == YWInspectionLineTypeEquipment) {
        YWEquipment *equipment = inspectionMission.inspectionLine.equipments.count?inspectionMission.inspectionLine.equipments[0]:nil;
        if (equipment.buildingId) {
            building = [[YWBuildingManager shareManager] buildingWithId:equipment.buildingId];
        }else{
            building = [[YWBuildingManager shareManager] buildingWithEquipmentId:equipment.equipmentId];
        }
    }else{
        YWInspectionLineLocationRel *locationRel = inspectionMission.inspectionLine.locationRels.count>0?inspectionMission.inspectionLine.locationRels[0]:nil;
        building = [[YWBuildingManager shareManager] buildingWithLocationId:locationRel.locationId];
    }
    //[_inspectionSiteLabel labelText:@"位置: " withAttributedText:building.buildingName.length>0?building.buildingName:@"无" andAttributedColor:[UIColor blackColor]];
    NSString *locationText = building.buildingName.length>0?building.buildingName:NSLocalizedString(@"none", nil);
    _inspectionSiteLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"locationFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:locationText secondColor:[UIColor blackColor] font:kContentFont];
    
    //巡查线路
    NSString *lineName = inspectionMission.inspectionLine.inspectionLineId==0 ? NSLocalizedString(@"tempInspection", nil) : (inspectionMission.inspectionLine.inspectionLineName?:NSLocalizedString(@"none", nil));
    //[_inspectionRoutLabel labelText:@"路线: " withAttributedText:lineName andAttributedColor:[UIColor blackColor]];
    _inspectionRoutLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"lineFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:lineName secondColor:[UIColor blackColor] font:kContentFont];
    
    //要求
    //[_noteLabel labelText:@"要求: " withAttributedText:[NSString stringWithFormat:@"%@",inspectionMission.inspectionLine.note.length>0?inspectionMission.inspectionLine.note:@"无"] andAttributedColor:[UIColor blackColor]];
    NSString *demandText = [NSString stringWithFormat:@"%@",inspectionMission.inspectionLine.note.length>0?inspectionMission.inspectionLine.note:NSLocalizedString(@"none", nil)];
    _noteLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"demandFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:demandText secondColor:[UIColor blackColor] font:kContentFont];
    
    //巡查日
    __block NSString *weekStr = @"";
    [inspectionMission.inspectionLine.weekRels enumerateObjectsUsingBlock:^(YWInspectionLineWeekRel*  _Nonnull weekRel, NSUInteger idx, BOOL * _Nonnull stop) {
        if (idx!=0) {
            weekStr = [weekStr stringByAppendingString:@","];
        }
        weekStr = [weekStr stringByAppendingString:[YWCommonTool weekDayString:weekRel.week]];
    }];
    //[_inspectionDay labelText:@"巡查日: " withAttributedText:weekStr.length?weekStr:@"无" andAttributedColor:[UIColor blackColor]];
    _inspectionDay.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"inspectionDayFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:weekStr.length?weekStr:NSLocalizedString(@"none", nil) secondColor:[UIColor blackColor] font:kContentFont];
    
    //开始日期
    NSString *startDate = inspectionMission.startDate ? [YWCommonTool showTime:inspectionMission.startDate/1000 andFormatter:KTimeFormatShortDate] : NSLocalizedString(@"none", nil);
    //[_startTimeLabel labelText:@"开始日期: " withAttributedText:startDate andAttributedColor:[UIColor blackColor]];
    _startTimeLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"startDateFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:startDate secondColor:[UIColor blackColor] font:kContentFont];
    
    //结束日期
    NSString *endDate = inspectionMission.endDate ? [YWCommonTool showTime:inspectionMission.endDate/1000 andFormatter:KTimeFormatShortDate] : NSLocalizedString(@"none", nil);
    //[_endTimeLabel labelText:@"结束日期: " withAttributedText:endDate andAttributedColor:[UIColor blackColor]];
    _endTimeLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"endDateFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:endDate secondColor:[UIColor blackColor] font:kContentFont];
    
    //每日巡查时间
    NSString *startEndTime= [NSString stringWithFormat:@"%@ - %@",inspectionMission.startTime?:@"",inspectionMission.endTime?:@""];
    //[_daylyInspectionTimeLabel labelText:@"每日巡查: " withAttributedText:startEndTime andAttributedColor:[UIColor blackColor]];
    _daylyInspectionTimeLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"inspectionTimeByDay", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:startEndTime secondColor:[UIColor blackColor] font:kContentFont];
    
    //巡查间隔
    NSString *timeStr = inspectionMission.inspectionMissionId ? [YWCommonTool minuteToHourOrDayString:inspectionMission.inspectionLine.intervalMinute] : @"无";
    //[_inspectionIntervalLabel labelText:@"巡查间隔: " withAttributedText:timeStr andAttributedColor:[UIColor blackColor]];
    _inspectionIntervalLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"inspectionIntervalFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:timeStr secondColor:[UIColor blackColor] font:kContentFont];
    
    //当前巡查时间
    NSString *timeString = NSLocalizedString(@"none", nil);
    if (inspectionMission.inspectionMissionId) {
        NSString *startTime = nil;
        NSString *endTime = nil;
        NSArray *intervalArray = inspectionMission.currentLooperTimeArray.count ? inspectionMission.currentLooperTimeArray : [YWCommonTool looperTimeArrayWithMission:inspectionMission];
        
        NSTimeInterval lineRecordStarTime = (intervalArray?[[intervalArray firstObject] longLongValue]:0);
        NSTimeInterval lineRecordEndTime = (intervalArray?[[intervalArray lastObject] longLongValue]:0);
        if (inspectionMission.inspectionLine.intervalMinute>24*60) {
            startTime = [YWCommonTool showTime:lineRecordStarTime andFormatter:KTimeFormatShortDate];
            endTime = [YWCommonTool showTime:lineRecordEndTime andFormatter:KTimeFormatShortDate];
        }else{
            startTime = [YWCommonTool showTime:lineRecordStarTime andFormatter:KTimeFormatShortTime];
            endTime = [YWCommonTool showTime:lineRecordEndTime andFormatter:KTimeFormatShortTime];
        }
        timeString = (lineRecordStarTime==0 && lineRecordEndTime==0) ? NSLocalizedString(@"notWorkTime", nil) :[NSString stringWithFormat:@"%@ - %@",startTime?:@"",endTime?:@""];
    }
    
    //[_nowInspectionTimeLabel labelText:@"当前巡查: " withAttributedText:timeString andAttributedColor:[UIColor customYellowColor]];
    _nowInspectionTimeLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"currentInspectionTime", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:timeString secondColor:[UIColor customYellowColor] font:kContentFont];
    
    //已完成
    NSInteger count = 1;
    if (inspectionMission.inspectionMissionId) {
        NSString *uniqueTag = inspectionMission.uniqueTag.length ? inspectionMission.uniqueTag : [YWCommonTool uniqueTagWithMission:inspectionMission];
        count = [[YWInspectionMissionManager shareManager] countOfInspectionEquipmentRecordWithUniqueTag:uniqueTag];
    }
    //[_hasFinishLabel labelText:@"已完成: " withAttributedText:[NSString stringWithFormat:@"%lu个",(unsigned long)count] andAttributedColor:[UIColor customYellowColor]];
    NSString *finishText = [NSString stringWithFormat:@"%lu个",(unsigned long)count];
    _hasFinishLabel.attributedText = [YWCommonTool attributedTextWithFirstText:@"已完成: " firstColor:[UIColor customTextGrayBlackColor] secondText:finishText secondColor:[UIColor customYellowColor] font:kContentFont];
    
//    //    评论
//    NSInteger replyCount = [[YWReplyManager shareManager] replysCountWithtRelationId:inspectionMission.inspectionMissionId relationType:YWReplyRelationTypeInspection];
//    _replyNumberLabel.text = [@(replyCount) stringValue];
//    //参与者
//    NSInteger observerCount = inspectionMission.executors.count;
//    NSInteger uniqueId = inspectionMission.creator.uniqueId;
//    NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"%K = %ld", @"uniqueId", uniqueId];
//    NSArray *array = [[inspectionMission.executors filteredArrayUsingPredicate:searchPredicate] mutableCopy];
//    if (array.count==0) {
//        observerCount++;
//    }
//    if (inspectionMission.observers.count>0) {
//        observerCount = observerCount + inspectionMission.observers.count;
//    }
//    _observerNumberLabel.text = [@(observerCount) stringValue];
    
    [self setupPreferredMaxLayoutWidth];
}

- (void)setupPreferredMaxLayoutWidth{
    self.inspectionManLabel.preferredMaxLayoutWidth = self.inspectionManLabel.frame.size.width;
    self.inspectionSiteLabel.preferredMaxLayoutWidth = self.inspectionSiteLabel.frame.size.width;
    self.inspectionRoutLabel.preferredMaxLayoutWidth = self.inspectionRoutLabel.frame.size.width;
    self.noteLabel.preferredMaxLayoutWidth = self.noteLabel.frame.size.width;
    self.inspectionDay.preferredMaxLayoutWidth = self.inspectionDay.frame.size.width;
}

-(NSString *)getMissionManString:(NSArray *)targeArray{
    NSString *handlers = [YWCommonTool handlerNamesWithHandlers:targeArray];
    return handlers;
}

- (void)setUpSubviews {
    UIView *superview = self.contentView;
    /**
     *  头像 名字
     *  头像 时间
     */
    [self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.and.top.mas_equalTo(superview).offset(8);
        make.width.and.height.mas_equalTo(@46);
    }];
    
    [self.responseNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(_headImageView.mas_centerY).offset(-2);
        make.left.mas_equalTo(_headImageView.mas_right).offset(6);
    }];
    
    [self.createTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_responseNameLabel);
        make.top.mas_equalTo(_responseNameLabel.mas_bottom).offset(4);
    }];
    /**
     *  编号
     *  巡查人
     *  位置
     *  路线
     *  要求
     *  巡查日
     */

    [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_headImageView.mas_bottom).offset(6);
        make.left.mas_equalTo(superview).offset(8);
        make.right.mas_equalTo(superview).offset(-8);
    }];
    
    [self.inspectionManLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_numberLabel.mas_bottom).offset(6);
    }];
    
    [self.inspectionSiteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_inspectionManLabel.mas_bottom).offset(6);
        
    }];
    
    [self.inspectionRoutLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_inspectionSiteLabel.mas_bottom).offset(6);
    }];
    
    [self.noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_inspectionRoutLabel.mas_bottom).offset(6);
    }];
    
    [self.inspectionDay mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_noteLabel.mas_bottom).offset(6);
        make.left.and.right.mas_equalTo(@[_numberLabel,_inspectionManLabel , _inspectionSiteLabel, _inspectionRoutLabel, _noteLabel]);
    }];
    /**
     *  开始日期    结束日期
     *  每日巡查    巡查间隔
     *  当前巡查    已完成
     */
    [self.startTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_inspectionDay.mas_bottom).offset(6);
        make.right.mas_equalTo(superview.mas_centerX).offset(30);
    }];
    
    
    [self.daylyInspectionTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_startTimeLabel.mas_bottom).offset(6);
    }];
    
    
    [self.nowInspectionTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_daylyInspectionTimeLabel.mas_bottom).offset(6);
        make.left.mas_equalTo(@[_numberLabel, _startTimeLabel, _daylyInspectionTimeLabel]);
        make.right.mas_equalTo(@[_startTimeLabel, _daylyInspectionTimeLabel]);
        make.bottom.mas_equalTo(superview).offset(-6);
    }];
    
    [self.endTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(_startTimeLabel);
        make.left.mas_equalTo(superview.mas_centerX).offset(30);
        make.right.mas_equalTo(superview).offset(-8);
    }];
    
    [self.inspectionIntervalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(_daylyInspectionTimeLabel);
    }];
    [self.hasFinishLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(_nowInspectionTimeLabel);
        make.left.and.right.mas_equalTo(@[_endTimeLabel, _inspectionIntervalLabel]);
    }];
//    [self.replyIcon mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.bottom.mas_equalTo(superview);
//        make.width.mas_equalTo(@23);
//        make.height.mas_equalTo(@23);
//    }];
//    [self.replyNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(_replyIcon.mas_top);
//        make.left.mas_equalTo(self.replyIcon.mas_right).offset(8);
//        make.right.mas_equalTo(superview).offset(-15);
//        make.bottom.mas_equalTo(_replyIcon.mas_bottom);
//        make.width.mas_lessThanOrEqualTo(@80);
//    }];
//    [self.observerIcon mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.bottom.mas_equalTo(superview);
//        make.width.mas_equalTo(@23);
//        make.height.mas_equalTo(@23);
//    }];
//    [self.observerNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(_observerIcon.mas_top);
//        make.left.mas_equalTo(_observerIcon.mas_right).offset(8);
//        make.right.mas_equalTo(_replyIcon.mas_left).offset(-15);
//        make.bottom.mas_equalTo(_observerIcon.mas_bottom);
//        make.width.mas_lessThanOrEqualTo(@80);
//    }];
}

- (UIImageView *)headImageView{
    if (!_headImageView) {
        UIImageView *imageView = [UIImageView new];
        imageView.layer.masksToBounds = YES;
        imageView.layer.cornerRadius = 46/2;
        _headImageView = imageView;
        [self.contentView addSubview:_headImageView];
    }
    return _headImageView;
}

- (YYLabel *)responseNameLabel{
    if (!_responseNameLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor blackColor];
        _responseNameLabel = label;
        [self.contentView addSubview:_responseNameLabel];
    }
    return _responseNameLabel;
}

- (YYLabel *)createTimeLabel{
    if (!_createTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _createTimeLabel = label;
        [self.contentView addSubview:_createTimeLabel];
    }
    return _createTimeLabel;
}

- (YYLabel *)numberLabel{
    if (!_numberLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _numberLabel = label;
        [self.contentView addSubview:_numberLabel];
    }
    return _numberLabel;
}

- (YYLabel *)inspectionManLabel{
    if (!_inspectionManLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionManLabel = label;
        [self.contentView addSubview:_inspectionManLabel];
    }
    return _inspectionManLabel;
}

- (YYLabel *)inspectionSiteLabel{
    if (!_inspectionSiteLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionSiteLabel = label;
        [self.contentView addSubview:_inspectionSiteLabel];
    }
    return _inspectionSiteLabel;
}

- (YYLabel *)inspectionRoutLabel{
    if (!_inspectionRoutLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionRoutLabel = label;
        [self.contentView addSubview:_inspectionRoutLabel];
    }
    return _inspectionRoutLabel;
}

- (YYLabel *)noteLabel{
    if (!_noteLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _noteLabel = label;
        [self.contentView addSubview:_noteLabel];
    }
    return _noteLabel;
}

- (YYLabel *)inspectionDay{
    if (!_inspectionDay) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionDay = label;
        [self.contentView addSubview:_inspectionDay];
    }
    return _inspectionDay;
}

- (YYLabel *)startTimeLabel{
    if (!_startTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _startTimeLabel = label;
        [self.contentView addSubview:_startTimeLabel];
    }
    return _startTimeLabel;
}

- (YYLabel *)endTimeLabel{
    if (!_endTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _endTimeLabel = label;
        [self.contentView addSubview:_endTimeLabel];
    }
    return _endTimeLabel;
}

- (YYLabel *)daylyInspectionTimeLabel{
    if (!_daylyInspectionTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _daylyInspectionTimeLabel = label;
        [self.contentView addSubview:_daylyInspectionTimeLabel];
    }
    return _daylyInspectionTimeLabel;
}

- (YYLabel *)inspectionIntervalLabel{
    if (!_inspectionIntervalLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionIntervalLabel = label;
        [self.contentView addSubview:_inspectionIntervalLabel];
    }
    return _inspectionIntervalLabel;
}

- (YYLabel *)nowInspectionTimeLabel{
    if (!_nowInspectionTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _nowInspectionTimeLabel = label;
        [self.contentView addSubview:_nowInspectionTimeLabel];
    }
    return _nowInspectionTimeLabel;
}

- (YYLabel *)hasFinishLabel{
    if (!_hasFinishLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _hasFinishLabel = label;
        [self.contentView addSubview:_hasFinishLabel];
    }
    return _hasFinishLabel;
}

//- (YYLabel *)replyNumberLabel{
//    if (!_replyNumberLabel) {
//        YYLabel *label = [[YYLabel alloc] init];
//        label.font = kContentFont;
//        label.textColor = [UIColor customTextGrayBlackColor];
//        _replyNumberLabel = label;
//        [self.contentView addSubview:_replyNumberLabel];
//    }
//    return _replyNumberLabel;
//}
//
//- (UIImageView *)replyIcon{
//    if (!_replyIcon) {
//        UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"remind_replyIcon"]];
//        _replyIcon = imageView;
//        [self.contentView addSubview:_replyIcon];
//    }
//    return _replyIcon;
//}
//
//- (UIImageView *)observerIcon{
//    if (!_observerIcon) {
//        UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"common_members"]];
//        _observerIcon = imageView;
//        [self.contentView addSubview:_observerIcon];
//    }
//    return _observerIcon;
//}
//
//- (YYLabel *)observerNumberLabel{
//    if (!_observerNumberLabel) {
//        YYLabel *label = [[YYLabel alloc] init];
//        label.font = kContentFont;
//        label.textColor = [UIColor customTextGrayBlackColor];
//        _observerNumberLabel = label;
//        [self.contentView addSubview:_observerNumberLabel];
//    }
//    return _observerNumberLabel;
//}

@end
